## search.html
<%!
from itertools import cycle 
colors = cycle( [ 'even', 'odd' ] )
%>

<%inherit file="base.html"/>
<%def name="title()">
    Search
</%def>

<h1 align="center">Search</h1>

<div align="center">
	<form action="search" method="get">
	Search terms <input type="text" name="word" value="${param.word}">
	<input type="submit" name="submit" value="Search!">
	</form>
</div>

% if param.word:
		
	% if len(query)>0:
		<h4 align="center">Showing the best ${len(query)} matches</h4>
	
		<table align="center" class="data_table" cellpadding="6" cellspacing="0">
			<tr align="center">
				<th width="25%">Name</td>
				<th width="25%">Chromosome</td>
				<th width="25%">Start:End</td>
				<th width="25%">Type</td>
			</tr>
			% for color, row in zip(colors, query):
				${makerow(color, row)}
			% endfor
		</table>

	% else:
		<h4 align="center">No results found</h4>
	% endif
		
%endif

<br>
<%def name="makerow(color, row)">
    <tr class="${color}" align="center">
		<td><a href="/?chrom=${row.chrom}&feature=${row.start}">${row.name}, ${row.altname}</a></td>
		<td>${row.chrom}</td>
		<td>${row.start}:${row.end}</td>
		<td>${row.label.name}</td>
    </tr>
</%def>

</form>
